Location: BondGraph Basic @ 994dbbb88a76 / BG Tutorial Fluid Systems / 1-SingleTube.cellml

Author:
Soroush <ssaf006@aucklanduni.ac.nz>
Date:
2021-04-08 15:18:19+12:00
Desc:
modified svg
Permanent Source URI:
https://models.fieldml.org/workspace/43b/rawfile/994dbbb88a761fe3a62bfaf8352da94103650bb2/BG Tutorial Fluid Systems/1-SingleTube.cellml

<?xml version='1.0' encoding='UTF-8'?>
<model name="SingleTube" xmlns="http://www.cellml.org/cellml/1.1#" xmlns:cellml="http://www.cellml.org/cellml/1.1#" xmlns:xlink="http://www.w3.org/1999/xlink">
    <import xlink:href="Units.cellml">
        <units name="m3" units_ref="m3"/>
        <units name="m3_per_s" units_ref="m3_per_s"/>
        <units name="m6_per_J" units_ref="m6_per_J"/>
        <units name="J_per_s" units_ref="J_per_s"/>
        <units name="J_per_m3" units_ref="J_per_m3"/>
        <units name="J_s_per_m3" units_ref="J_s_per_m3"/>
        <units name="J_s_per_m6" units_ref="J_s_per_m6"/>
        <units name="J_s2_per_m5" units_ref="J_s2_per_m5"/>
        <units name="J_s2_per_m6" units_ref="J_s2_per_m6"/>
    </import>
    <component name="main">
        <variable name="t" units="second"/>
        <variable initial_value="1.0" name="period" units="second"/>
        <!-- State variables-->
        <variable initial_value="0" name="q_in" units="m3"/>
        <variable initial_value="0" name="q_out" units="m3"/>
        <variable initial_value="0" name="q1" units="m3"/>
        <variable name="v_in" units="m3_per_s"/>
        <variable initial_value="0" name="v1" units="m3_per_s"/>
        <variable initial_value="0" name="u_out" units="J_per_m3"/>
        <variable name="u1" units="J_per_m3"/>
        <!-- Constitutive parameters-->
        <variable initial_value="0.004" name="mu" units="J_s_per_m3"/>
        <variable initial_value="1050" name="rho" units="J_s2_per_m5"/>
        <variable initial_value="20.0e-3" name="l" units="metre"/>
        <variable initial_value="2.3e-3" name="r" units="metre"/>
        <variable initial_value="0.5e-3" name="h" units="metre"/>
        <variable initial_value="0.4e+6" name="E" units="J_per_m3"/>
        <variable name="C1" units="m6_per_J"/>
        <variable name="R1" units="J_s_per_m6"/>
        <variable name="I1" units="J_s2_per_m6"/>
        <variable initial_value="20.0e-2" name="a1" units="dimensionless"/>
        <variable initial_value="0.2" name="b1" units="dimensionless"/>
        <variable initial_value="0.08" name="c1" units="dimensionless"/>
        <!-- Inlet flow-->
        <math xmlns="http://www.w3.org/1998/Math/MathML">
            <apply>
                <eq/>
                <ci>v_in</ci>
                <apply>
                    <times/>
                    <ci>a1</ci>
                    <apply>
                        <exp/>
                        <apply>
                            <minus/>
                            <apply>
                                <power/>
                                <apply>
                                    <divide/>
                                    <apply>
                                        <minus/>
                                        <apply>
                                            <minus/>
                                            <ci>t</ci>
                                            <apply>
                                                <times/>
                                                <ci>period</ci>
                                                <apply>
                                                    <floor/>
                                                    <apply>
                                                        <divide/>
                                                        <ci>t</ci>
                                                        <ci>period</ci>
                                                    </apply>
                                                </apply>
                                            </apply>
                                        </apply>
                                        <ci>b1</ci>
                                    </apply>
                                    <ci>c1</ci>
                                </apply>
                                <cn cellml:units="dimensionless">2</cn>
                            </apply>
                        </apply>
                    </apply>
                </apply>
            </apply>
            <!-- Conservation laws-->
            <apply>
                <eq/>
                <apply>
                    <diff/>
                    <bvar>
                        <ci>t</ci>
                    </bvar>
                    <ci>q_in</ci>
                </apply>
                <ci>v_in</ci>
            </apply>
            <apply>
                <eq/>
                <apply>
                    <diff/>
                    <bvar>
                        <ci>t</ci>
                    </bvar>
                    <ci>q_out</ci>
                </apply>
                <ci>v1</ci>
            </apply>
            <apply>
                <eq/>
                <apply>
                    <diff/>
                    <bvar>
                        <ci>t</ci>
                    </bvar>
                    <ci>q1</ci>
                </apply>
                <apply>
                    <minus/>
                    <ci>v_in</ci>
                    <ci>v1</ci>
                </apply>
            </apply>
            <apply>
                <eq/>
                <apply>
                    <diff/>
                    <bvar>
                        <ci>t</ci>
                    </bvar>
                    <ci>v1</ci>
                </apply>
                <apply>
                    <divide/>
                    <apply>
                        <minus/>
                        <apply>
                            <minus/>
                            <ci>u1</ci>
                            <ci>u_out</ci>
                        </apply>
                        <apply>
                            <times/>
                            <ci>R1</ci>
                            <ci>v1</ci>
                        </apply>
                    </apply>
                    <ci>I1</ci>
                </apply>
            </apply>
            <!-- Constitutive relations-->
            <apply>
                <eq/>
                <ci>C1</ci>
                <apply>
                    <divide/>
                    <apply>
                        <times/>
                        <cn cellml:units="dimensionless">3</cn>
                        <pi/>
                        <apply>
                            <power/>
                            <ci>r</ci>
                            <cn cellml:units="dimensionless">3</cn>
                        </apply>
                        <ci>l</ci>
                    </apply>
                    <apply>
                        <times/>
                        <cn cellml:units="dimensionless">2</cn>
                        <ci>E</ci>
                        <ci>h</ci>
                    </apply>
                </apply>
            </apply>
            <apply>
                <eq/>
                <ci>R1</ci>
                <apply>
                    <divide/>
                    <apply>
                        <times/>
                        <cn cellml:units="dimensionless">8</cn>
                        <ci>mu</ci>
                        <ci>l</ci>
                    </apply>
                    <apply>
                        <times/>
                        <pi/>
                        <apply>
                            <power/>
                            <ci>r</ci>
                            <cn cellml:units="dimensionless">4</cn>
                        </apply>
                    </apply>
                </apply>
            </apply>
            <apply>
                <eq/>
                <ci>I1</ci>
                <apply>
                    <divide/>
                    <apply>
                        <times/>
                        <ci>rho</ci>
                        <ci>l</ci>
                    </apply>
                    <apply>
                        <times/>
                        <pi/>
                        <apply>
                            <power/>
                            <ci>r</ci>
                            <cn cellml:units="dimensionless">2</cn>
                        </apply>
                    </apply>
                </apply>
            </apply>
            <apply>
                <eq/>
                <ci>u1</ci>
                <apply>
                    <divide/>
                    <ci>q1</ci>
                    <ci>C1</ci>
                </apply>
            </apply>
        </math>
    </component>
</model>